package alg.list;

/**
 * @author:yuziji
 * @create: 2023-04-16 15:36
 */
public class Node {
    int value;
    Node next;
    Node prev;

    public Node() {
    }

    public Node(int value) {
        this.value = value;
    }

    public Node(int value, Node next, Node prev) {
        this.value = value;
        this.next = next;
        this.prev = prev;
    }

    @Override
    public String toString() {
        return "Node{" +
                "value=" + value +
                '}';
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public Node getNext() {
        return next;
    }

    public void setNext(Node next) {
        this.next = next;
    }

    public Node getPrev() {
        return prev;
    }

    public void setPrev(Node prev) {
        this.prev = prev;
    }


    /**
     * 输出链表
     * @param head
     */
    public void printNode(Node head){

        while(head!=null){
            System.out.println(head.value);
            head = head.next;
        }
    }
}
